package view.campaign;

import java.awt.event.ActionListener;

import javax.swing.JPanel;
import javax.swing.SpringLayout;
import javax.swing.JTextField;
import javax.swing.JSeparator;
import javax.swing.JLabel;
import javax.swing.JTextArea;
import javax.swing.JButton;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import javax.swing.border.BevelBorder;
import javax.swing.UIManager;

public class CampaignManagment extends JPanel
{
	private JButton btnSave;
	private JButton btnUpdate;
	private JButton btnDelete;
	private JButton btnBack;
	private JButton btnExit;
	private JButton btnSearch;
	private JButton btnForward;
	private JLabel btnNewButton_7;
	private JButton btnClear;
	private JLabel lblCampaignName;
	private JLabel lblCreatedBy;
	private JLabel lblStartDate;
	private JLabel lblEndDate;
	private JLabel lblDescription;
	private JTextField tCampName;
	private JTextField tCreatedBy;
	private JTextField tStartDate;
	private JTextField tEndDate;
	private JButton[] buttongrp=new JButton[8];
	private JTextArea textAreaDescription;
	
	public CampaignManagment() 
	{
		SpringLayout springLayout = new SpringLayout();
		setLayout(springLayout);
		this.setBackground(new Color(239,239,239));
	    this.setPreferredSize(new Dimension(360,550));
		
		/*
		 * SETTING LABELS
		 */
		 String[] labelsTitle = {"Name: ", "Phone: ", "Email: ", "Address: "};
		 JLabel[] labels=new JLabel[4];
		 
		 for(int i=0;i<labels.length;i++)
		 {
			 labels[i]=new JLabel(labelsTitle[i], JLabel.TRAILING);
			 add(labels[i]);
		 }
		
		
		
		lblCampaignName = new JLabel("Campaign Name");
		lblCampaignName.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.NORTH, lblCampaignName, 30, SpringLayout.NORTH, this);
		springLayout.putConstraint(SpringLayout.WEST, lblCampaignName, 30, SpringLayout.WEST, this);
		add(lblCampaignName);
		
		tCampName = new JTextField();
		tCampName.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.NORTH, tCampName, 6, SpringLayout.SOUTH, lblCampaignName);
		springLayout.putConstraint(SpringLayout.WEST, tCampName, 30, SpringLayout.WEST,this);
		add(tCampName);
		tCampName.setPreferredSize(new Dimension(300, 23));
		
		
		lblCreatedBy = new JLabel("Ceated By");
		lblCreatedBy.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.NORTH, lblCreatedBy, 25, SpringLayout.SOUTH, tCampName);
		springLayout.putConstraint(SpringLayout.WEST, lblCreatedBy, 0, SpringLayout.WEST, lblCampaignName);
		add(lblCreatedBy);
		

		tCreatedBy = new JTextField();
		tCreatedBy.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.NORTH, tCreatedBy, 6, SpringLayout.SOUTH, lblCreatedBy);
		springLayout.putConstraint(SpringLayout.WEST, tCreatedBy, 0, SpringLayout.WEST, lblCampaignName);
		add(tCreatedBy);
		tCreatedBy.setPreferredSize(new Dimension(300, 23));
		
		
		
		lblStartDate = new JLabel("Start Date");
		lblStartDate.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.NORTH, lblStartDate, 25, SpringLayout.SOUTH, tCreatedBy);
		springLayout.putConstraint(SpringLayout.WEST, lblStartDate, 0, SpringLayout.WEST, lblCampaignName);
		add(lblStartDate);
		
		tStartDate = new JTextField();
		tStartDate.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.NORTH, tStartDate, 6, SpringLayout.SOUTH, lblStartDate);
		springLayout.putConstraint(SpringLayout.WEST, tStartDate, 0, SpringLayout.WEST, lblCampaignName);
		add(tStartDate);
		tStartDate.setPreferredSize(new Dimension(300, 23));
		
		
		
		lblEndDate = new JLabel("End Date");
		lblEndDate.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.NORTH, lblEndDate, 25, SpringLayout.SOUTH, tStartDate);
		springLayout.putConstraint(SpringLayout.WEST, lblEndDate, 0, SpringLayout.WEST, lblCampaignName);
		add(lblEndDate);
		

		tEndDate = new JTextField();
		tEndDate.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.NORTH, tEndDate, 6, SpringLayout.SOUTH, lblEndDate);
		springLayout.putConstraint(SpringLayout.WEST, tEndDate, 0, SpringLayout.WEST, lblCampaignName);
		add(tEndDate);
		tEndDate.setPreferredSize(new Dimension(300, 23));
		
		
		lblDescription = new JLabel("Description");
		lblDescription.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.NORTH, lblDescription, 25, SpringLayout.SOUTH, tEndDate);
		springLayout.putConstraint(SpringLayout.WEST, lblDescription, 0, SpringLayout.WEST, lblCampaignName);
		add(lblDescription);
		
		textAreaDescription = new JTextArea();
		textAreaDescription.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.NORTH, textAreaDescription, 6, SpringLayout.SOUTH, lblDescription);
		springLayout.putConstraint(SpringLayout.WEST, textAreaDescription, 0, SpringLayout.WEST, lblCampaignName);
		add(textAreaDescription);
		textAreaDescription.setPreferredSize(new Dimension(300, 50));
		
		
		
		JPanel panel = new JPanel();
		springLayout.putConstraint(SpringLayout.NORTH, panel, 25, SpringLayout.SOUTH, textAreaDescription);
		springLayout.putConstraint(SpringLayout.WEST, panel, 30, SpringLayout.WEST,this);
		add(panel);
		panel.setPreferredSize(new Dimension(300, 120));
		GridLayout g=new GridLayout(3, 3,2,2);
		panel.setLayout(g);

		btnSave = new JButton("SAVE  ");
		btnSave.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		panel.add(btnSave);
		btnSave.setActionCommand("SAVE");
		
		btnDelete = new JButton("MARK INACTIVE");
		btnDelete.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		panel.add(btnDelete);
		btnDelete.setActionCommand("MARK INACTIVE");
		
		btnUpdate = new JButton("UPDATE");
		btnUpdate.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		panel.add(btnUpdate);
		btnUpdate.setActionCommand("UPDATE");
		
		btnBack = new JButton("  <<  ");
		btnBack.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		panel.add(btnBack);
		btnBack.setActionCommand("<< ");
		
		btnSearch = new JButton("SEARCH");
		btnSearch.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		panel.add(btnSearch);
		btnSearch.setActionCommand("SEARCH");
		
		btnForward = new JButton(">>");
		btnForward.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		panel.add(btnForward);
		btnForward.setActionCommand(">>");
		
		btnNewButton_7 = new JLabel("");
		panel.add(btnNewButton_7);
		
		btnClear = new JButton("CLEAR ");
		btnClear.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		panel.add(btnClear);
		btnClear.setActionCommand("CLEAR");
		
		btnExit = new JButton("EXIT  ");
		btnExit.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		panel.add(btnExit);
		btnExit.setActionCommand("EXIT");
		
	}
	
	public JButton getBtnSave() {
		return btnSave;
	}


	public void setBtnSave(JButton btnSave) {
		this.btnSave = btnSave;
	}


	public JButton getBtnUpdate() {
		return btnUpdate;
	}


	public void setBtnUpdate(JButton btnUpdate) {
		this.btnUpdate = btnUpdate;
	}


	public JButton getBtnDelete() {
		return btnDelete;
	}


	public void setBtnDelete(JButton btnDelete) {
		this.btnDelete = btnDelete;
	}


	public JButton getBtnBack() {
		return btnBack;
	}


	public void setBtnBack(JButton btnBack) {
		this.btnBack = btnBack;
	}


	public JButton getBtnExit() {
		return btnExit;
	}


	public void setBtnExit(JButton btnExit) {
		this.btnExit = btnExit;
	}


	public JButton getBtnSearch() {
		return btnSearch;
	}


	public void setBtnSearch(JButton btnSearch) {
		this.btnSearch = btnSearch;
	}


	public JButton getBtnForward() {
		return btnForward;
	}


	public void setBtnForward(JButton btnForward) {
		this.btnForward = btnForward;
	}


	public JLabel getBtnNewButton_7() {
		return btnNewButton_7;
	}


	public void setBtnNewButton_7(JLabel btnNewButton_7) {
		this.btnNewButton_7 = btnNewButton_7;
	}


	public JButton getBtnClear() {
		return btnClear;
	}


	public void setBtnClear(JButton btnClear) {
		this.btnClear = btnClear;
	}


	public JLabel getLblCampaignName() {
		return lblCampaignName;
	}


	public void setLblCampaignName(JLabel lblCampaignName) {
		this.lblCampaignName = lblCampaignName;
	}


	public JLabel getLblCreatedBy() {
		return lblCreatedBy;
	}


	public void setLblCreatedBy(JLabel lblCreatedBy) {
		this.lblCreatedBy = lblCreatedBy;
	}


	public JLabel getLblStartDate() {
		return lblStartDate;
	}


	public void setLblStartDate(JLabel lblStartDate) {
		this.lblStartDate = lblStartDate;
	}


	public JLabel getLblEndDate() {
		return lblEndDate;
	}


	public void setLblEndDate(JLabel lblEndDate) {
		this.lblEndDate = lblEndDate;
	}


	public JLabel getLblDescription() {
		return lblDescription;
	}


	public void setLblDescription(JLabel lblDescription) {
		this.lblDescription = lblDescription;
	}


	public JTextField gettCampName() {
		return tCampName;
	}


	public void settCampName(JTextField tCampName) {
		this.tCampName = tCampName;
	}


	public JTextField gettCreatedBy() {
		return tCreatedBy;
	}


	public void settCreatedBy(JTextField tCreatedBy) {
		this.tCreatedBy = tCreatedBy;
	}


	public JTextField gettStartDate() {
		return tStartDate;
	}


	public void settStartDate(JTextField tStartDate) {
		this.tStartDate = tStartDate;
	}


	public JTextField gettEndDate() {
		return tEndDate;
	}


	public void settEndDate(JTextField tEndDate) {
		this.tEndDate = tEndDate;
	}


	public JButton[] getButtongrp() {
		return buttongrp;
	}

	public void setButtongrp(JButton[] buttongrp) {
		this.buttongrp = buttongrp;
	}

	public JTextArea getTextAreaDescription() {
		return textAreaDescription;
	}

	public void setTextAreaDescription(JTextArea textAreaDescription) {
		this.textAreaDescription = textAreaDescription;
	}

	public void actionListener(ActionListener al)
	{
		for(int i=0;i<buttongrp.length;i++)
		{
			buttongrp[i].addActionListener(al);
		}
	}
}
